create trigger Stock_ProductoByDetalle
on detalleventa after insert as
update P set p.Stock = p.Stock - i.cantidad
from inserted as i inner join PRODUCTO as P on
i.IdProducto = p.id